﻿using Microsoft.Win32;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Resources;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;

namespace resReader
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            var x = new OpenFileDialog();
            x.DefaultExt = "resources";
            x.Multiselect = false;
            x.InitialDirectory = Environment.CurrentDirectory;
            if (x.ShowDialog() == true)
            {
                resTxt.Clear();
                var rsReader = new ResourceReader(x.FileName);
                foreach (var item in rsReader)
                {
                    if (item is DictionaryEntry)
                    {
                        resTxt.Text += ((DictionaryEntry)item).Key + "\t:" + ((DictionaryEntry)item).Value + "\n";
                    }
                }
            }

        }
    }
}
